<?php
	
?>
	<h1>Administration</h1>
<?php 
	if((empty($_SESSION['login'])))
	{
		if(empty($_POST['login']))
		{
?>
			<form method="post" action="index.php?page=5">
				Login : <input type="text" name="login" />
				<br/>
				Mot de passe : <input type="password" name="passwd" />
				<input type="submit" value="Envoyer">
			</form>
<?php 
		}
		else 
		{
			$user = new login() ;
			$valide = $user->verifierLogin($_POST['login'],$_POST['passwd']) ;
			if($valide)
			{
				
				$_SESSION['login']=$_POST['login'];
				
				echo "Vous etes maintenant connecte sous : ".$_SESSION['login']."<br/>" ;
			}
			else 
			{ ?>
				<form method="post" action="index.php?page=5">
				Login : <input type="text" name="login" />
				<br/>
				Mot de passe : <input type="password" name="passwd" />
				<input type="submit" value="Envoyer">
			</form>
			<?php 
				echo "Login ou mot de passe errone ! " ;
			}
		}
	}
	else 
	{
			echo "Vous etes connecte : ".$_SESSION['login'] ;
	}
?>